var route = function(){

    this.use('/user', route.user);
    this.use('/merchant', route.merchant);
    this.use('/open', route.open);
    this.use('/order', route.order);

    // catch 404 and forward to error handler
    this.use(function(req, res, next) {
      var err = new Error('Not Found');
      err.status = 404;
      next(err);
    });

    // error handler
    this.use(function(err, req, res, next) {
      // set locals, only providing error in development
      res.locals.message = err.message;
      res.locals.error = req.app.get('env') === 'development' ? err : {};

      // render the error page
      res.status(err.status || 500);
      res.render('error');
    });

};

route.user = require('./routes/user');
route.merchant = require('./routes/merchant');
route.open = require('./routes/open');
route.order = require('./routes/order');

module.exports = route;
